import Mock from "mockjs";

const DealList = Mock.mock("/dealwith/page","post",options => {
  const { page=1, size=10 } = JSON.parse(options.body)
  const info = {
    success: true,
    code: 200,
    message: '操作成功',
    data: {
      // 属性 list 的值是一个数组，其中含有 1 到 5 个元素
      'content|10': [{
          // 属性 sid 是一个自增数，起始值为 1，每次增 1
          'id|+1': 1,
          // 属性 userId 是一个5位的随机码
          'type|1': ['产品问题','订单问题','费用问题','返利问题'],
          'customerName': '@ctitle(5, 8)',
          'FeedbackTitle': '@ctitle',
          'clientCode': '@increment(1000)',
          'state|1': ['待处理','处理中','已处理'],
          'RecentHandler':'@CNAME',
          FeedbackTime: '@datetime()',
          processingTime: '@datetime()'
      }],
      number: 1,
      numberOfElements: 10,
      size: 10,
      totalElements: 1169,
      totalPages: 117,
    }
  }
  console.log(Mock.mock(info))
  return Mock.mock(info)
})
const purchaseDetail = Mock.mock(RegExp('/dealwith/page' + ".*"), "get", (options)=>{
  const info = {
    success: true,
    code: 200,
    message: '操作成功',
    data: {
      'id|+1': 1,
      // 属性 userId 是一个5位的随机码
      'type|1': ['产品问题','订单问题','费用问题','返利问题'],
      'customerName': '@ctitle(5, 8)',
      'FeedbackTitle': '@ctitle',
      'clientCode': '@increment(1000)',
      'state|1': ['待处理','处理中','已处理'],
      'RecentHandler':'@CNAME',
      'phone':/^1(5|3|7|8)[0-9]{9}$/,
      "Pic": "@Image('100x100','#c33')",
      'ContentPast':{'service':[
        {'time':'@datetime()','company':'@ctitle(4,6)','text':'@ctitle(6, 25)','uid':'1'},
        {'time':'@datetime()','company':'@CNAME','text':'@ctitle(6, 25)','uid':'2'},
        {'time':'@datetime()','company':'@ctitle(4,6)','text':'@ctitle(6, 25)','uid':'1'},
        {'time':'@datetime()','company':'@CNAME','text':'@ctitle(6, 25)','uid':'2'},
        {'time':'@datetime()','company':'@ctitle(4,6)','text':'@ctitle(6, 25)','uid':'1'},
        {'time':'@datetime()','company':'@CNAME','text':'@ctitle(6, 25)','uid':'2'},
        {'time':'@datetime()','company':'@ctitle(4,6)','text':'@ctitle(6, 25)','uid':'1'},
        {'time':'@datetime()','company':'@CNAME','text':'@ctitle(6, 25)','uid':'2'},
        {'time':'@datetime()','company':'@CNAME','text':'@ctitle(6, 25)','uid':'2'},
        {'time':'@datetime()','company':'@CNAME','text':'@ctitle(6, 25)','uid':'2'},
        {'time':'@datetime()','company':'@CNAME','text':'@ctitle(6, 25)','uid':'2'}
      ]},
      FeedbackTime: '@datetime()',
      processingTime: '@datetime()'
    }
  }
  console.log(Mock.mock(info))
  return Mock.mock(info)
 
})

export const DealMock = {
    DealList,
    purchaseDetail
}